home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995…tember: Reference Library / Dev.CD Sep 95 RL / Dev.CD Sep 95 RL.toast / mac / Technical Documentation / develop / develop Issue 21 code / Custom GX Printer Drivers / CustomWriter GX 1.0.1 / CommonDefines.h < prev    next >
Encoding:
Text File  |  1995-05-03  |  5.5 KB  |  170 lines  |  [TEXT/MPS ]

  1. /*
  2.     FILENAME
  3.         CommonDefines.h
  4.  
  5.     DESCRIPTION
  6.         Contains defines and prototypes used by more than one .r or .h file.
  7.  
  8.     COPYRIGHT
  9.         Copyright © 1995 Apple Computer, Inc.
  10.         All rights reserved.
  11.     
  12.     Modification history
  13.         05/03/95 - Dave Hersey -    Version 1.0.1 to fix some minor bugs in
  14.                                     CustomBufferingAndIO.c.
  15.  
  16.         01/14/95 - Dave Hersey -    Created from the shell of a hollowed-out
  17.                                     ImageWriter driver.
  18.  
  19.     NOTE: Relevant goodies are listed in MPW's "Mark" menu.
  20.  
  21. */
  22.  
  23.  
  24. // Driver info
  25. #define DriverName        "CustomWriter GX"
  26. #define DriverCreator     'cuWR'
  27. #define DriverType         'pdvr'
  28.  
  29. // Code segment info-- all driver overrides go in 'pdvr' resources;
  30. // these are the IDs we use for ours.
  31. #define NewSegID        0
  32. #define OldSegID        1
  33.  
  34. // The creator and type of the files we create.  (SimpleText PICTs)
  35. #define kFileCreator    'ttxt'
  36. #define kFileType        'PICT'
  37.  
  38. // Status defines
  39. #define kTransmissionStatID        gxPrintingDriverBaseID    // stat resource ID
  40. #define kSendingPartStatIdx        1    // item number for sending data
  41. #define kPreparingPartStatIdx    2    // item number for preparing data
  42. #define kPrintingPageStatIdx    3    // item number for writing page
  43.  
  44. // Chooser initialize message selector (wasn't in pre-ETO 16 headers).
  45. #define initializeMsg    11
  46.  
  47. // Resource ID for icon that we show in the Chooser's device list.
  48. #define r_ChooserIcon    1000
  49.  
  50. // The number and size of our custom buffers.
  51. #define kOurBufferSize    (20 *1024)
  52. #define kNumBuffs        (4)
  53.  
  54. // Defines used by the old-application compatibility code.
  55. #define kPortrait            (0x04)
  56. #define kPrintRecordVers    (12)
  57. #define kDriverWDev            (0x8800)
  58.  
  59. // do the following only if we aren't running in Rez
  60. #ifndef REZ
  61.  
  62. #include <Devices.h>
  63. #include <Errors.h>
  64. #include <FixMath.h>
  65. #include <Folders.h>
  66. #include <Font Library.h>
  67. #include <Fonts.h>
  68. #include <Graphics Libraries.h>
  69. #include <Graphics Routines.h>
  70. #include <GXExceptions.h>
  71. #include <Layout Routines.h>
  72. #include <Lists.h>
  73. #include <LowMem.h>
  74. #include <Memory.h>
  75. #include <PrintingDrivers.h>
  76. #include <PrintingLibraries.h>
  77. #include <PrintingManager.h>
  78. #include <PrintingMessages.h>
  79. #include <Math Routines.h>
  80. #include <Math Types.h>
  81. #include <QuickDraw.h>
  82. #include <Resources.h>
  83. #include <Script.h>
  84. #include <StandardFile.h>
  85. #include <ToolUtils.h>
  86. #include <Types.h>
  87.  
  88. // Our global data structure
  89.  
  90. typedef struct
  91. {
  92.     long        lineFeeds;                // accumulated lines feeds
  93.     FSSpec        fileLocation;            // Where to put our files.
  94.     short        curFileRefNum;            // refNum of current open file.
  95.     long        pagesImaged;            // Number of pages imaged.
  96.     long        lastYPos;                // Used by our RasterDatIn override.
  97.     Rect        pixMapBounds;            // Bounds of the pixmap we create.
  98.     short        pixMapRowBytes;            // rowBytes of the pixmap we create.
  99.     Fixed        hRes;                    // Horizontal output resolution.
  100.     Fixed        vRes;                    // Vertical output resolution.
  101. } DriverGlobals, *DriverGlobalsPtr, **DriverGlobalsHdl;
  102.  
  103.  
  104. // Our buffer description
  105.  
  106. typedef struct
  107. {
  108.     Boolean                bufferIsDirty;                // Is this buffer dirty (is there data to be written out)?
  109.     long                curOffset;                    // where's the next byte go in this buffer?
  110.     gxPrintingBuffer    printBuffer;                // The buffer itself.
  111.     char                xData[kOurBufferSize -1];    // the printBuffer's data. (access it through
  112.                                                     // the printBuffer field)
  113. } BufferEntry, *BufferEntryPtr, **BufferEntryHdl;
  114.  
  115.  
  116. // our buffer group description-- a collection of BufferEntry records plus info.
  117.  
  118. typedef struct
  119. {
  120.     short        numBuffers;                // number of buffers
  121.     long        bufferSize;                // and their sizes.
  122.     short        curBuff;                // current buffer we're writing to.
  123.     BufferEntry    buff[1];                // individual buffer records.
  124. } BufferGroup, *BufferGroupPtr, **BufferGroupHdl;
  125.  
  126.  
  127. // Routines to save and retrieve our jump table globals.  These
  128. // routines are in NewApp.a
  129.  
  130. extern void SetDriverGlobals(DriverGlobalsHdl theGlobals);
  131. extern DriverGlobalsHdl GetDriverGlobals(void);
  132.  
  133. // Our prototypes in alphabetical order.
  134.  
  135. OSErr            CreateAndStoreGlobals(DriverGlobalsHdl *driverGlobalsHdl);
  136. OSErr            CreateBuffers(void);
  137. pascal OSErr    Device(short message, short caller, StringPtr objName, 
  138.                        StringPtr zoneName, ListHandle theList, long p2);
  139. OSErr            DisposeBuffers(void);
  140. void            DisposeGlobals(void);
  141. OSErr            FlushBuffers(BufferGroupHdl buffGrpHdl);
  142. pascal void        LDEF(short message, Boolean select, Rect *theRect,
  143.                      Cell theCell, short dataOffset, short dataLen, ListHandle theList);
  144. OSErr            SD_BufferData(Ptr data, long length, long bufferOptions);
  145. OSErr            SD_ChooserMessage(short message, short caller, StringPtr objName,
  146.                                   StringPtr zoneName, ListHandle theList, long p2);
  147. void            SD_CleanupOpenConnection(void);
  148. OSErr            SD_CloseConnection(void);
  149. OSErr            SD_ConvertPrintRecordFrom(gxUniversalPrintRecordHdl huPrint);
  150. OSErr            SD_ConvertPrintRecordTo(THPrint hoPrint);
  151. OSErr            SD_DefaultDesktopPrinter(Str31 dtpName);
  152. OSErr            SD_DumpBuffer(gxPrintingBuffer *theBuffer);
  153. OSErr            SD_FinishSendPage(void);
  154. OSErr            SD_FreeBuffer(gxPrintingBuffer *theBuffer);
  155. OSErr            SD_ImageJob(gxSpoolFile theSpoolFile, long *closeOptions);
  156. OSErr            SD_OpenConnection(void);
  157. OSErr            SD_PrValidate(THPrint hPrint, Boolean *wasChanged);
  158. OSErr            SD_RasterDataIn (gxOffscreenHdl hOffscreen, gxRectangle *bandRect, gxRectangle *dirtyRect);
  159. OSErr            SD_SetupImageData(gxRasterImageDataHdl hImageData);
  160. OSErr            SD_StartSendPage(gxFormat pageFormat);
  161. OSErr            SD_WriteData(Ptr data, long length);
  162. OSErr            UpdatePrintRecord(THPrint hPrint);
  163. OSErr            WriteBlankLines(long numBlankLinesToDo, gxRectangle *bandRect);
  164. OSErr            WriteEndOfPICTFile(void);
  165. OSErr            WriteStartOfPICTFile(void);
  166. OSErr            WriteRawData(void *dataBuffer, long dataLength);
  167.  
  168. #endif REZ
  169.  
  170.